//
//  TTView.m
//  TT
//
//  Created by lanou3g on 16/3/11.
//  Copyright © 2016年 Super磊. All rights reserved.
//

#import "TTView.h"
#import "OverlapLayout.h"

@implementation TTView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addAllViews];
    }
    return self;
}

- (void)addAllViews {
    //设置地图
    self.mapV = [[MKMapView alloc] initWithFrame:CGRectMake(kScreenWidth / 2 - kMapSize / 2, kScreenHeight / 2 - kMapSize / 2 - 64, kMapSize, kMapSize)];
    [self addSubview:self.mapV];
    self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(kMapSize / 2 - 50, kMapSize / 2 - 50, 100, 100)];
    self.imageV.layer.cornerRadius = 50;
    self.imageV.layer.masksToBounds = YES;
    [self.mapV addSubview:self.imageV];
    self.imageV.userInteractionEnabled = YES;
    //请求到数据后添加的视图
    self.showV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    self.showV.backgroundColor = [UIColor whiteColor];
    
    self.cancel = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.cancel setFrame:CGRectMake(60, kScreenHeight - 120 - 64, 80, 80)];
    [self.cancel setImage:[UIImage imageNamed:@"cancel"] forState:(UIControlStateNormal)];
    self.cancel.tintColor = [UIColor grayColor];
    [self.showV addSubview:self.cancel];
    
    self.agree = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.agree setFrame:CGRectMake(kScreenWidth - 140 , CGRectGetMinY(self.cancel.frame), 80, 80)];
    [self.agree setImage:[UIImage imageNamed:@"agree"] forState:(UIControlStateNormal)];
    [self.agree setTintColor:[UIColor redColor]];
    [self.showV addSubview:self.agree];
    
    self.detail = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [self.detail setFrame:CGRectMake((kScreenWidth - 280 - 30)/2 + 140  , kScreenHeight - 100 - 64, 30, 30)];
    [self.detail setImage:[UIImage imageNamed:@"detail"] forState:(UIControlStateNormal)];
    self.detail.tintColor = [UIColor grayColor];
    [self.showV addSubview:self.detail];
    
    OverlapLayout *overL = [[OverlapLayout alloc] init];
    self.collectionV = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 64 - 130) collectionViewLayout:overL];
    self.collectionV.backgroundColor = [UIColor cyanColor];
    [self.showV addSubview:self.collectionV];
    
    
    
    
    
    
    
    
//    self.first = [[UIView alloc] initWithFrame:CGRectMake(10, 10, kScreenWidth - 20, kScreenWidth - 20 + 60)];
//    self.second = [[UIView alloc] initWithFrame:CGRectMake(20, 40, kScreenWidth - 40, kScreenWidth - 40 + 60)];
//    self.third = [[UIView alloc] initWithFrame:CGRectMake(30, 70, kScreenWidth - 60, kScreenWidth - 60 + 60)];
//    [self.showV addSubview:self.third];
//    [self.showV addSubview:self.second];
//    [self.showV addSubview:self.first];
//    self.first.backgroundColor = [UIColor cyanColor];
//    self.second.backgroundColor = [UIColor redColor];
//    self.third.backgroundColor = [UIColor yellowColor];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
